home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / ELF / elf_error3e.txt < prev    next >
Encoding:
Text File  |  1996-11-11  |  1.7 KB  |  51 lines

  1.  
  2. elf_error(3E)                  Silicon Graphics                  elf_error(3E)
  3.  
  4. NAME
  5.      elf_errmsg, elf_errno - error handling
  6.  
  7. SYNOPSIS
  8.      cc [flag ...] file ...  -lelf [library ...]
  9.  
  10.      #include <libelf.h>
  11.  
  12.      const char *elf_errmsg(int err);
  13.      int elf_errno(void);
  14.  
  15. DESCRIPTION
  16.      If an ELF library function fails, a program may call elf_errno to
  17.      retrieve the library's internal error number.  As a side effect, this
  18.      function resets the internal error number to zero, which indicates no
  19.      error.
  20.  
  21.      elf_errmsg takes an error number, err, and returns a null-terminated
  22.      error message (with no trailing new-line) that describes the problem.  A
  23.      zero err retrieves a message for the most recent error.  If no error has
  24.      occurred, the return value is a null pointer (not a pointer to the null
  25.      string).  Using err of -1 also retrieves the most recent error, except it
  26.      guarantees a non-null return value, even when no error has occurred.  If
  27.      no message is available for the given number, elf_errmsg returns a
  28.      pointer to an appropriate message.  This function does not have the side
  29.      effect of clearing the internal error number.
  30.  
  31. EXAMPLE
  32.      The following fragment clears the internal error number and checks it
  33.      later for errors.  Unless an error occurs after the first call to
  34.      elf_errno, the next call will return zero.
  35.  
  36.           (void)elf_errno();
  37.           while (more_to_do)
  38.           {
  39.                   /* processing ... */
  40.                   if ((err = elf_errno()) != 0)
  41.                   {
  42.                           msg = elf_errmsg(err);
  43.                           /* print msg */
  44.                   }
  45.           }
  46.  
  47. SEE ALSO
  48.      elf(3E), elf_version(3E).
  49.  
  50. Page 1                           Release 6.2
  51.